package stark.app.function.imgmodel;

import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder;

import java.util.List;
import java.util.Map;

import stark.app.R;
import stark.app.databinding.ItemImgModelBinding;
import stark.common.api.StkResApi;
import stark.common.base.IReqRetCallback;
import stark.common.basic.adapter.BaseLoadMoreAdapter;
import stark.common.bean.StkResBean;

/**
 * Author：daizhongbin on 2025/5/21
 * Email：1027154338@qq.com
 * Desc:
 */
public class ImgModelNoTestAdapter extends BaseLoadMoreAdapter<StkResBean, ItemImgModelBinding> {

    public ImgModelNoTestAdapter() {
        super(R.layout.item_img_model, 0);
    }

    @Override
    protected void convert(@NonNull BaseDataBindingHolder<ItemImgModelBinding> holder, StkResBean resBean) {
        ImageView ivImg = holder.getView(R.id.ivImg);
        Glide.with(ivImg).load(resBean.getThumbUrl()).into(ivImg);
    }

    @Override
    protected void reqLoadData(int page, int pageSize, @NonNull ILoadDataCallback<StkResBean> callback) {
        Map<String, Object> paramMap = StkResApi.createParamMap(page, pageSize);
        String url = "http://biteapi.starkos.cn/api/tag/getTagResourceList/c9zKY2GyVCP";
        StkResApi.getTagResourceList(null, url, paramMap, new IReqRetCallback<List<StkResBean>>() {
            @Override
            public void onResult(boolean success, String msg, @Nullable List<StkResBean> result) {
                callback.onLoadedData(success, result);
            }
        });
    }
}
